﻿using System;
using System.Windows.Data;
using compshop.Infrastructure;

namespace compshop.Modules.ClientOrderList.Presenter
{
    [ValueConversion(typeof(int), typeof(string))]
    public class ClientOrderStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int ind=(int)value;
            return Status.StatusClientOrder[ind];
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string str=(string)value;

            for (int i = 0; i < Status.StatusClientOrder.Length; i++)
                if (Status.StatusClientOrder[i] == str)
                    return i;
            return value;
        }
    }
}
